package edu.uwm.capstone.diasmart.database;

import edu.uwm.capstone.util.Identifiable;
import edu.uwm.capstone.util.StringUtil;

public class SubType implements Identifiable {
	private long id = -1L;
	private boolean isDefault = false;
	private boolean isUserDefault = false;
	private boolean modified = false;
	private String name;
	private int typeId = -1;
	private String unit = null;
	private int userOrder = 0;

	public SubType() {
	}

	public SubType(int paramInt, String paramString, boolean paramBoolean) {
		this(-1L, paramInt, paramString, paramBoolean);
		this.modified = true;
	}

	public SubType(long paramLong, int paramInt, String paramString,
			boolean paramBoolean) {
		this(paramLong, paramInt, paramString, paramBoolean, null, 0, false);
	}

	public SubType(long paramLong, int paramInt1, String paramString1,
			boolean paramBoolean1, String paramString2, int paramInt2,
			boolean paramBoolean2) {
		this.id = paramLong;
		this.typeId = paramInt1;
		this.name = paramString1;
		this.isDefault = paramBoolean1;
		this.unit = paramString2;
		this.userOrder = paramInt2;
		this.isUserDefault = paramBoolean2;
	}

	public long getId() {
		return this.id;
	}

	public String getName() {
		return this.name;
	}

	public int getTypeId() {
		return this.typeId;
	}

	public String getUnit() {
		return this.unit;
	}

	public int getUserOrder() {
		return this.userOrder;
	}

	public boolean isDefault() {
		return this.isDefault;
	}

	public boolean isModified() {
		return this.modified;
	}

	public boolean isUserDefault() {
		return this.isUserDefault;
	}

	public void setDefault(boolean paramBoolean) {
		if (this.isDefault != paramBoolean) {
			this.isDefault = paramBoolean;
			this.modified = true;
		}
	}

	void setId(long paramLong) {
		this.id = paramLong;
	}

	void setModified(boolean paramBoolean) {
		this.modified = paramBoolean;
	}

	public void setName(String paramString) {
		if (!StringUtil.isEqual(this.name, paramString)) {
			this.name = paramString;
			this.modified = true;
		}
	}

	public void setTypeId(int paramInt) {
		if (this.typeId != paramInt) {
			this.typeId = paramInt;
			this.modified = true;
		}
	}

	public void setUnit(String paramString) {
		if (!StringUtil.isEqual(this.unit, paramString)) {
			this.unit = paramString;
			this.modified = true;
		}
	}

	public void setUserDefault(boolean paramBoolean) {
		if (this.isUserDefault != paramBoolean) {
			this.isUserDefault = paramBoolean;
			this.modified = true;
		}
	}

	public void setUserOrder(int paramInt) {
		if (this.userOrder != paramInt) {
			this.userOrder = paramInt;
			this.modified = true;
		}
	}

	public String toString() {
		return this.name;
	}
}